use  "${replication}\data\for_census_analysis.dta", clear



estimates clear

global absorb "i.s_code"
global cluster "sd_code"
global final_year 2010

global depvars " coalition_2004 year_elc_2004 pc01_vd_p_sch_d pc01_vd_m_sch_d pc01_vd_s_sch_d pc01_vd_s_s_sch_d pc01_vd_college_d ln_pc01_pca_no_hh ln_pc01_pca_tot_p pc01_pca_p_sc_share pc01_pca_p_st_share pc01_pca_p_lit_share pc01_vd_power_agr pc01_vd_power_dom pc01_vd_power_all pc01_vd_dirt_road  ln_pc01_vd_area  ln_tdist_10 ln_tdist_50 ln_tdist_100 ln_tdist_500 tot_irr_share_2001  h_cntr_1_2001_d ph_cntr_1_2001_d drnk_wat_f_1_2001_d post_off_1_2001_d phone_1_2001_d "


label var coalition_2004 "MLA party aligns w/ state"
label var year_elc_2004 "MLA election year"
label var pc01_vd_p_sch_d "Primary school"
label var pc01_vd_m_sch_d "Middle school"
label var pc01_vd_s_sch_d "Secondary school"
label var pc01_vd_s_s_sch_d  "Senior secondary school"
label var pc01_vd_college_d "College"
label var ln_pc01_pca_no_hh "Log of number of households"
label var ln_pc01_pca_tot_p "Log of population"
label var pc01_pca_p_sc_share "Scheduled caste share"
label var pc01_pca_p_st_share "Scheduled tribe share"
label var pc01_pca_p_lit_share "Literacy rate"
label var pc01_vd_power_agr "Electricity for agriculture"
label var pc01_vd_power_dom "Electricity for domestic use"
label var pc01_vd_power_all "Electricity for all purposes"
label var pc01_vd_dirt_road "Dirt road"
label var pc01_vd_tar_road 	"Tar road"
label var ln_pc01_vd_area  "Log of village area"
label var ln_tdist_10 "Log of km to town (10k)"
label var ln_tdist_50 "Log of km to town (50k)"
label var ln_tdist_100 "Log of km to town (100k)"
label var ln_tdist_500 "Log of km to town (500k)"
label var tot_irr_share_2001  "Log of irrigation share"
label var h_cntr_1_2001_d "Health centre"
label var ph_cntr_1_2001_d "Primary health centre"
label var drnk_wat_f_1_2001_d "Drinking water"
label var post_off_1_2001_d "Post office"
label var phone_1_2001_d "Landline phone"


foreach var of varlist $depvars{
	reghdfe `var'     elec_by_${final_year} road_by_${final_year} ${int}_by_${final_year}  , absorb( $absorb) cluster($cluster)
	qui estadd ysumm, mean
	qui estimate store `var'
	
}

estimates table _all , keep(*by*) stats(N $terms ymean) star(.1 .05 .01)
